package edu.llg.oojcodesandbox.controller;

import edu.llg.oojcodesandbox.CodeSandBox;
import edu.llg.oojcodesandbox.model.ExecuteCodeRequest;
import edu.llg.oojcodesandbox.model.ExecuteCodeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 隆利果
 * @version 1.0
 * @date 2024/2/20 17:08
 */
@RestController
public class ExecController {
    @Resource
    private CodeSandBox javaNativeCodeSandBox;

    @PostMapping("/executeCode")
    public ExecuteCodeResult executeCode(@RequestBody ExecuteCodeRequest executeCodeRequest){
        ExecuteCodeResult executeCodeResult = javaNativeCodeSandBox.executeCode(executeCodeRequest);
        return executeCodeResult;
    }

}
